//
//  UIBarButtonItem+Extension.swift
//  Sina
//
//  Created by maling  on 15/11/15.
//  Copyright © 2015年 maling . All rights reserved.
//

import UIKit

extension UIBarButtonItem {

    ///   遍历构造哈数
    convenience init(imageName: String, target: AnyObject?, actionName: String?) {
    
        let button = UIButton(imageName: imageName, backImage: nil)
        
        // 判断actionName
        if let actionName: String = actionName {
        
            button.addTarget(target, action: Selector(actionName), forControlEvents: .TouchUpInside)
            
        }
        
        self.init(customView: button)
    }

        
        

}
